package com.webchat.common.enums.messagequeue;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum MessageQueueEnum {

    QUEUE_CHATTING_LIST_REFRESH("queue_chatting_list_refresh", "聊天对话列表刷新队列"),

    QUEUE_CHAT_MESSAGE("queue_chat_message", "聊天消息队列"),

    QUEUE_OFFICIAL_ARTICLE_PUSH_MESSAGE("queue_official_article_push_message", "公众号推文"),

    QUEUE_PERSISTENT_MESSAGE("queue_persistent_message", "消息持久化队列"),

    QUEUE_CHAT_VIDEO_P2P("queue_chat_video_p2p", "P2P（一对一）音视频聊天信令消息队列"),

    QUEUE_CHAT_VIDEO_MESH("queue_chat_video_mesh", "基于Mesh模式的多人音视频聊天信令消息队列"),

    QUEUE_MOMENT_PUBLISH("queue_moment_publish", "朋友圈动态发布消息队列"),

    QUEUE_SYNC_SEARCH_DB_MESSAGE("queue_sync_search_db_message", "同步搜索服务存储队列"),

    QUEUE_PAYMENT_CALL_BACK_TASK_MESSAGE("queue_payment_call_back_task_message", "支付结果回调队列"),

    QUEUE_MALL_ORDER_TIMEOUT_DELAY_MESSAGE("queue_mall_order_timeout_delay_message", "(延迟消息)电商订单支付超时消息"),

    QUEUE_MALL_ORDER_TIMEOUT_MESSAGE("queue_mall_order_timeout_message", "（普通队列）电商订单支付超时消息"),

    QUEUE_MALL_PRODUCT_UPDATE_STOCK_MESSAGE("queue_mall_product_stock_update_message", "电商商品库存更新消息"),

    QUEUE_MALL_USER_CART_UPDATE_MESSAGE("queue_mall_user_cart_message", "电商用户购物车新增删除更新消息"),

    QUEUE_MALL_CHAT_ACCOUNT_LIST_MESSAGE("queue_mall_chat_account_message", "电商智能客服系统对话列表变更MQ消息"),

    UGC_TO_NETTY_MESSAGE("webchat_ugc_message", "电商智能客服确认走Netty消息推送队列topic"),

    UGC_PERSISTENT_MALL_IM_MESSAGE("queue_ugc_persistent_mall_im_message", "商家智能客服IM消息持久化到Mongo Topic"),

    DELAY_QUEUE_MALL_AI_IM_AUTO_MSG("delay_queue_mall_ai_im_auto_msg", "商家智能客服机器人消息代发延迟队列"),
    ;

    private String queue;

    private String queueName;


    /**
     * 根据队列topic名称获取枚举对象
     *
     * @param queue
     * @return
     */
    public static MessageQueueEnum getByQueue(String queue) {
        for (MessageQueueEnum messageQueueEnum : MessageQueueEnum.values()) {
            if (messageQueueEnum.getQueue().equals(queue)) {
                return messageQueueEnum;
            }
        }
        return null;
    }
}
